﻿@using MvcPaging
@using QuocHoi_TV_Frontend.Models;
@model IPagedList<QuocHoi_TV_Frontend.Models.News>
<div class="catavideos">
	<div class="header_catavideos">
		<h2>@Model[0].Category.CateName</h2>
		<div class="page_header_catavideos">
            @Html.Raw(Ajax.Pager(
            new Options
            {
               PageSize = Model.PageSize,
               TotalItemCount = Model.TotalItemCount,
               CurrentPage = Model.PageNumber,
               ItemTexts = new ItemTexts() { Next = "", Previous = "", Page = "", First = "", Last = "" },
               ItemIcon = new ItemIcon() { First = "icon-backward", Previous = "icon-chevron-left", Next = "icon-chevron-right", Last = "icon-forward" },
               
               Size = Size.normal,
               Alignment = Alignment.centered,
               IsShowControls = true,
               IsShowFirstLast = true
            },
            new AjaxOptions
            {
                UpdateTargetId = "grid-list",
                OnBegin = "beginPaging",
                OnSuccess = "successPaging",
                OnFailure = "failurePaging"
            }, new { controller = "Broadcast", action = "Detail"}))
			
		</div>
	</div>
	<div class="box_catavideos">
		<ul>
            @foreach (var item in Model)
            {
                string link = Url.RouteUrl("BroadCastDetail",
                    new
                    {
                        controller = "Broadcast",
                        action = "Detail",
                        cate_name = Util.RemoveSign4VietnameseString(item.Category.CateName),
                        news_title = Util.RemoveSign4VietnameseString(item.NewsTitle),
                        newsID = item.NewsID
                    });
                <li>
				    <div class="imgshow_ttvideos">
					    <a href="@Html.Raw(link)">
						    <img src="@item.PathImgSmall" width="236" height="133">
						    <span class="iconplaysmall"></span>
						    @item.NewsTitle
					    </a>
				    </div>
			    </li>      
            }
		</ul>
	</div>
</div>
<script type="text/javascript">

    function beginPaging(args) {
        // Animate
        //$('#grid-list').fadeOut('normal');
    }

    function successPaging() {
        // Animate
        //$('#grid-list').fadeIn('normal');
        //$('a').tooltip();
    }

    function failurePaging() {
        alert("Could not retrieve list.");
    }

    function searchFailed() {
        $("#grid-list").html("Sorry, there was a problem with the search.");
    }

</script>